<template>
  <view class="default-layout">
    <view>
      <wd-navbar
        :title="title"
        left-text="返回"
        right-text="设置"
        left-arrow
        fixed
        placeholder
        safeAreaInsetTop
      >
        <template #capsule>
          <wd-navbar-capsule @back="handleBack" @back-home="handleBackHome" />
        </template>
      </wd-navbar>
    </view>
    <slot />
  </view>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
const title = ref('')

function handleBack() {
  uni.navigateBack()
}

function handleBackHome() {
  uni.reLaunch({ url: '/pages/index/index' })
}
</script>

<style lang="scss">
.default-layout {
  height: 100vh;
  overflow: auto;
  background-color: #fafafa;
}
</style>
